<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Var := expression</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>Var := expression</h1>

<p>Evaluates an expression and stores the result in a <a href="../Variables.htm">variable</a>.</p>

<pre class="Syntax">Var := expression</pre>
<h3>Parameters</h3>
<dl>

  <dt>Var</dt>
  <dd><p>The name of the <a href="../Variables.htm">variable</a> in which to store the result of <em>expression</em>.</p></dd>

  <dt>Expression</dt>
  <dd><p>See <a href="../Variables.htm#Expressions">expressions</a> and the examples below for details.</p></dd>

</dl>

<h3>Remarks</h3>
<p>The := operator is optimized so that it performs just as quickly as the = operator for simple cases such as the following:</p>
<pre>x := y  <em>; Same performance as x = %y%</em>
x := 5  <em>; Same performance as x = 5.</em>
x := &quot;literal string&quot;  <em>; Same performance as x = literal string.</em></pre>
<p>The words <code>true</code> and <code>false</code> are built-in constants containing 1 and 0. They can be used to make a script more readable as in these examples:</p>
<pre>CaseSensitive := false
ContinueSearch := true</pre>
<p>It is possible to create a <a href="../misc/Arrays.htm#pseudo">pseudo-array</a> with this command and any others that accept an <em>OutputVar</em>. This is done by making <em>OuputVar</em> contain a reference to another variable, e.g. <code>Array%i% := Var/100 + 5</code>. See <a href="../misc/Arrays.htm">Arrays</a> for more information.</p>
<h3>Related</h3>
<p><a href="../Variables.htm#Expressions">Expressions</a>, <a href="IfExpression.htm">IF (expression)</a>, <a href="../Functions.htm">Functions</a>, <a href="SetEnv.htm">SetEnv</a>, <a href="EnvSet.htm">EnvSet</a>, <a href="EnvAdd.htm">EnvAdd</a>, <a href="EnvSub.htm">EnvSub</a>, <a href="EnvMult.htm">EnvMult</a>, <a href="EnvDiv.htm">EnvDiv</a>, <a href="IfEqual.htm">If</a>, <a href="../misc/Arrays.htm">Arrays</a></p>
<h3>Examples</h3>
<pre class="NoIndent">Var := 3
Var := &quot;literal string&quot;
Var := Price * (1 - Discount/100)

Finished := not Done or A_Index &gt; 100
if not Finished
{
    FileAppend, %NewText%`n, %TargetFile%
    return
}
else
    ExitApp</pre>

</body>
</html>
